package io.lkt.modules.sys.service.impl;

import io.lkt.modules.sys.entity.BUserInfoEntity;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.lkt.common.utils.PageUtils;
import io.lkt.common.utils.Query;

import io.lkt.modules.sys.dao.BUserPromotionSettleInfoDao;
import io.lkt.modules.sys.entity.BUserPromotionSettleInfoEntity;
import io.lkt.modules.sys.service.BUserPromotionSettleInfoService;


@Service("bUserPromotionSettleInfoService")
public class BUserPromotionSettleInfoServiceImpl extends ServiceImpl<BUserPromotionSettleInfoDao, BUserPromotionSettleInfoEntity> implements BUserPromotionSettleInfoService {
    @Autowired
    BUserPromotionSettleInfoDao bUserPromotionSettleInfoDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<BUserPromotionSettleInfoEntity> page = this.page(
                new Query<BUserPromotionSettleInfoEntity>().getPage(params),
                new QueryWrapper<BUserPromotionSettleInfoEntity>().eq(StringUtils.isNotBlank(params.get("userId").toString()),"user_id", params.get("userId").toString())
        );

        return new PageUtils(page);
    }

    @Override
    public List<BUserPromotionSettleInfoEntity> queryList(Map<String, Object> map) {
        return bUserPromotionSettleInfoDao.queryList(map);
    }

    @Override
    public Integer queryTotal(Map<String, Object> map)
    {
        return this.bUserPromotionSettleInfoDao.queryTotal(map);
    }

    @Override
    public BUserPromotionSettleInfoEntity queryByUser(Integer userId) {
        return bUserPromotionSettleInfoDao.queryByUser(userId);
    }

}
